<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8" />
		<title>登录</title>
		<link rel="stylesheet" href="css/bootstrap.min.css" type="text/css" />
		<link rel="stylesheet" href="css/bootstrap-theme.min.css" type="text/css" />
		<link rel="stylesheet" href="css/style.css" type="text/css" />
		<script type="text/javascript" src="js/jquery.min.js"></script>
		<script type="text/javascript" src="js/bootstrap.min.js"></script>
		<style type="text/css">
			.container {
				margin: 50px auto;
				width: 1000px;
			}
			.my-link:active{
				color: red;			
			}
		</style>
	</head>

	<body>
		<div class="container">
			<form class="form-horizontal" action="../LoginServlet" method="POST">
				<div class="form-group">
					<label for="username" class="col-md-2 control-label">用户名</label>
					<div class="col-md-8">
						<input type="text" class="col-md-4 form-control" id="username" name="username" placeholder="Username">
					</div>
				</div>
				<div class="form-group">
					<label for="password" class="col-md-2 control-label">密	码</label>
					<div class="col-md-8">
						<input type="password" class="col-md-4 form-control" id="password" name="password" placeholder="Password">
					</div>
				</div>
				<div class="form-group">
					<div class="col-md-offset-2 col-md-3">
						<button type="submit" class="btn btn-primary btn-lg btn-block" onclick=" return validate()">登录</button>
					</div>
					<div class="col-md-offset-2 col-md-3">
						<button type="reset" class="btn btn-info btn-lg btn-block">重置</button>
					</div>
				</div>
			</form>
		</div>
		<script type="text/javascript">
			function validate(){				
				var usernameText = $("#username").val();
				var passwordText = $("#password").val();
				var msg = "";
				if(usernameText == null||usernameText.trim() == ""){
					msg = "用户名不能为空";
				}
				if(passwordText == null||passwordText.trim() == ""){
					msg = "密码不能为空";
				}
				if(msg == ""){
					$("form").submit();
				}else{
					alert(msg);
				}
			}
		</script>
	</body>
</html>